<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>03_项目增长收缩</title>
    <style>
        .box>div,.example {
            width: 200px;
            height: 200px;
            background-color: #ff0;
            border: 3px solid #f00;
        }
        .box {
            display: flex;
            background-color: lightblue;
        }
        /*.item3 {*/
        /*    !* 当父元素有剩余空间时,子项目默认不会增长,但若设置了此属性,按照比例分配父元素的剩余空间 *!*/
        /*    flex-grow: 1;*/
        /*}*/
        /*.item4 {*/
        /*    flex-grow: 2;*/
        /*}*/
        /*.item5 {*/
        /*    flex-grow: 3;*/
        /*}*/
        .box {
            width: 1000px;
        }
        .item3 {
            /* 即使父容器空间不足,也不会压缩 */
            flex-shrink: 0;
        }
        .item4 {
            flex-shrink: 1; /* 默认值,当父容器空间不足时,子项目默认会压缩大小*/
        }
        .item5 {
            flex-shrink: 2;/* 设置了多个,按比例压缩 */
        }
    </style>
</head>
<body>
    <div class="example">参考大小200px</div>
    <div class="box">
        <div class="item1">1</div>
        <div class="item2">2</div>
        <div class="item3">3</div>
        <div class="item4">4</div>
        <div class="item5">5</div>
        <div class="item6">6</div>
        <div class="item7">7</div>
    </div>
</body>
</html>